package cn.biplam.front.template.pageFrame.dbs;

import cn.biplam.common.tools.TOOLS;
import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.front.html.HtmlDiv;
import cn.biplam.front.html.base.HtmlWindow;
import cn.biplam.front.template.base.FieldSet;
import cn.biplam.front.template.base.SimpleTextArea;

/**
 * 数据探查—数据探查详细结果描述—界面模版<br>
 * <ul>  
 * <li> ("页面ID,宽度,结果内容")  创建数据探查结果模版
 * <li> get() 返回结果界面
 * </ul>
 * @author XiaoRuxing 2009-7-22下午04:31:05
 * @version 1.0
 */
public class DbsResultDescPanel {

	private HtmlDiv div;
	private String width;
	private String content;
	private String sTitle;

	/**
	 * 创建数据探查详细结果描述模版
	 * @param ID          页面ID
	 * @param width       宽度
	 * @param content  结果内容
	 */
	public DbsResultDescPanel(String ID,String width,String content){
		this(ID,width,content,null);
	}
	
	/**
	 * 创建数据探查详细结果描述模版
	 * @param ID          页面ID
	 * @param width       宽度
	 * @param content     结果内容
	 * @param sTitle      结果内容标题
	 */
	public DbsResultDescPanel(String ID,String width,String content,String sTitle){
		this.width = width;
		this.content = content;
		if(sTitle==null){
			this.sTitle = "探查结果";
		}else{
			this.sTitle = "探查结果:"+sTitle;
		}
		div = new HtmlDiv(ID);
	}
	
	/**
	 * 创建数据探查结果描述界面
	 * @return
	 * @throws ErrorMessage
	 */
	public HtmlWindow get() throws ErrorMessage{
		div.setStyleWidth(width);
		FieldSet fSet = new FieldSet(sTitle);
		int cols = TOOLS.stringToInt(width)/6-5;
		SimpleTextArea area = new SimpleTextArea(null,TOOLS.intToString(cols),"5",content,true);
		fSet.put(area.get());
		HtmlWindow fs = fSet.get();
		div.put(fs);
		return div;
	}
}
